package org.shj.basic

class Pepole{
  val counter = 3
  val array = new Array[Int](counter)
}

class Sporter extends Pepole{
  override val counter = 5
}

class Artist extends{ //此种方式override，可以查看输出的数组长度的变化
  override val counter = 7  
} with Pepole

object OverrideDemo extends App { // extends App 后，可以不用写main方法
  val s = new Sporter
  println(s.counter + "; arr.length=" + s.array.length)
  
  val a = new Artist
  println(a.counter + "; arr.length=" + a.array.length)
}